/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */
bool isUnivalTree(struct TreeNode* root) {
    if (NULL == root) return true;
    else if (root->left && root->val != root->left->val) return false;
    else if (root->right && root->val != root->right->val) return false;
    else return isUnivalTree(root->left) && isUnivalTree(root->right);
}